package site.yunnong.atvris.portal.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.yunnong.atvris.common.api.Page;
import site.yunnong.atvris.common.api.ResultVO;
import site.yunnong.atvris.service.UserReportService;
import site.yunnong.atvris.common.dto.UserReportParam;
import site.yunnong.atvris.common.dto.UserReportQueryParam;
import site.yunnong.atvris.common.dto.UserReportUpdateParam;

import java.util.Arrays;

/**
 * 用户举报表
 *
 * @author zhangjinghao
 * @email jhzhang9102@163.com
 * @date 2021-07-09 23:45:37
 */
@Api("用户举报相关")
@RestController
@RequestMapping("/user-report")
public class UserReportController {
    @Autowired
    private UserReportService userReportService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public ResultVO list(@RequestBody UserReportQueryParam param){
        Page page = userReportService.queryPage(param);
        return new ResultVO().success(page);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public ResultVO save(@RequestBody UserReportParam userReport){
		userReportService.save(userReport);
        return new ResultVO().success();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public ResultVO update(@RequestBody UserReportUpdateParam userReport){
		userReportService.updateById(userReport);

        return new ResultVO().success();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public ResultVO delete(@RequestBody Long[] ids){
		userReportService.removeByIds(Arrays.asList(ids));

        return new ResultVO().success();
    }

}
